<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css"
	rel="stylesheet">
<script src="${pageContext.request.contextPath}/js/jquery-1.7.2.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<link
	href="${pageContext.request.contextPath}/themes/material/easyui.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/themes/icon.css"
	rel="stylesheet">
<script src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
</head>

<script type="text/javascript">
$(function(){
	//配置学生数据表格
	$('#cashMsg').datagrid({
	    url:'${pageContext.request.contextPath}/findCash',
	    columns:[[    
	        {field:'checked',checkbox : true,width:150},
	        {field:'cid',title:'柜台号',width:150},
	        {field:'ccapital',title:'柜台本金',width:150},
	        {field:'cincome',title:'柜台收益',width:150},      
	    ]],
	    pagination : true,
	    striped : true,

	    toolbar: [{
			iconCls: 'icon-remove',
			text : '重置柜台收益',
			handler: function(){
				var cids='';
				var cashs = $("#cashMsg").datagrid('getSelections');
				$.each(cashs,function(n,v){
					cids=cids+v.cid+','
				})
				//js数组问题
				$.ajax({
					type:'post',
					url:'${pageContext.request.contextPath}/updateCash',
					data:{'cids':cids},
					dataType:"text",
					success:function(data){
					   if(data=='1'){
						   $.messager.alert('我的消息','重置成功','info',function(){
								$('#cashMsg').datagrid('reload');
							}); 
					   }
					}
				})
			}
	    
		}]
	    
	    
	});
	//配置点击按钮查看总收入
	$("#bt").click(function(){		
		var uname= $(this).text();
		$.ajax({
			type:'post',
			url:'${pageContext.request.contextPath}/findAllMoney',
			data:{"uname":uname},
			dataType:"text",
			success:function(d){
			$("#lb").text(d+"元");
			if(d>10000){
				$("#dd2").show();$("#dd1").hide()}
				else{$("#dd1").show();$("#dd2").hide()}

			}
		})
	})
	
})

</script>
<body>
	<table id="cashMsg"></table><br>
	
	<button id="bt" style="margin-left: 100px;margin-right: 20px;width: 200px;" type="button" class="btn btn-info">查看营业额</button>
	<span style="color: blue;font-size: x-large;" id="lb"></span>
	<div id="dd1" style="color: red;font-size: x-large;display: none;margin-left: 98px">
	今天收益不好哇T.T
	</div>
	<div id="dd2" style="color: green;font-size: x-large;display: none;margin-left: 98px">
	今天收益不错哦^_^
	</div>
</body>
</html>